home *** CD-ROM | disk | FTP | other *** search
- /********************************************************* DEFINITION
- DATE: 9/17/93
- AUTHOR: Eric R. Rosé
-
- CLASS: CPPWatchWriteTasks
-
- SUPERCLASS: CPeriodicTask
-
- This class waits until there are no write tasks in the queue
- it belongs to and then disposes of the memory it is
- started up with.
- Q: What could you possibly use this for?
- A: When you spawn a write task, it has to be assured that the
- data it is writing out won't get cleared. Normally you could
- tell it that it has ownership of the data and let it dispose
- of it when it is done. However, if you spawn many write tasks,
- all with the same data, you have no guarantee the one you gave
- ownership of the data to will complete last, or, indeed, at all.
- To solve this, do not give any of the write tasks ownership of
- the data, then spawn a CWatchWriteMemTask and give it the
- responsibility of disposing of the memory after all of the write
- tasks have completed.
-
- ********************************************************************/
-
- #pragma once
-
- #include <CPPPeriodicTask.h>
-
- class CPPTaskManager;
-
- class CPPWatchWriteTasks : public CPPPeriodicTask {
-
- public:
- CPPWatchWriteTasks (CPPTaskManager *TaskManager,
- long minPeriod);
- ~CPPWatchWriteTasks (void);
-
- virtual char *ClassName (void);
-
- void StartWatchTask (Ptr Data);
-
- virtual void DoPeriodicAction (void);
- virtual void DoCompletedAction (void);
-
- private:
- Ptr dataToWatch;
- };
-